﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PositionList.aspx.cs" Inherits="Manage_Modle_Position_PositionList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta content="MSHTML 6.00.2900.3132" name="GENERATOR" />
	<link href="../../css/mainFrom.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/common.js"></script>
	    <script language="javascript" type="text/javascript">
        parent.$("IFRAME_windowTab_<%=ROLESTR%><%=strPermissionID %>").style.height = "560px";
    </script>
	<script type="text/javascript" language="javascript">
	        function ExpandSubCategory(iCategoryID,FahterID)
		    {

			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (li_father.getElementsByTagName("li").length > 0) //如果已经加载了下级节点则直接展开，不必在去读取数据
			    {
				    ChangeStatus(iCategoryID);
				    return;
			    }
    			
			    li_father.className = "Opened";
			    //打开时显示稍等
			    switchNote(iCategoryID, true);
			    //AJAX回调函数，加载节点
			    
			    Dcms.BLL.Dcms_CateBLL.GetSubCategory(iCategoryID,'<%=Language %>', GetSubCategory_callback);				
		    }
            function ExpandSubCategoryAgain(iCategoryID,FahterID)
		    {

			    var li_father = document.getElementById("li_" + iCategoryID);
			    li_father.className = "Opened";
			    //打开时显示稍等
			    switchNote(iCategoryID, true);
			    //AJAX回调函数，加载节点
			    
			    Dcms.BLL.Dcms_CateBLL.GetSubCategory(iCategoryID,'<%=Language %>', GetSubCategory_callback);				
		    }
		    function GetSubCategory_callback(response)
		    {
			    var dt = response.value.Tables[0];
			    if (dt.Rows.length > 0)
			    {
				    var iCategoryID = dt.Rows[0].Cate_ParentID;
			    }
			    var li_father = document.getElementById("li_" + iCategoryID);
			    var ul_sub = document.getElementById("ulTree_" + iCategoryID); 
			    if(ul_sub != null){
			        li_father.removeChild(ul_sub)
			    }
			    var ul = document.createElement("ul");
			    ul.id = "ulTree_"+ iCategoryID
			    for (var i = 0;i < dt.Rows.length;i++)
			    {
				    if (dt.Rows[i].Cate_IsChild == 1) //如果已没有下一级节点
				    {
					    var li = document.createElement("li");
					    li.className = "Child";
					    li.id = "li_" + dt.Rows[i].Cate_ID;
    					
					    var img = document.createElement("img");
					    img.id = dt.Rows[i].Cate_ID;
					    img.className = "s";
					    img.src = "../../css/s.gif";
    					var imgNew = document.createElement("img");
			            imgNew.id = dt.Rows[i].Cate_ID;
			            imgNew.className = "s_1";
			            imgNew.src = "../../images/new.gif";
			            imgNew.onclick = function () {
				            OpenEditPage(this.id,"add");
			            };
			            imgNew.alt = "新建信息";
			            imgNew.width = 15;
			            imgNew.height = 15;
			            <% if (CL.IsAdd("POSITION")==false) {%>
				            imgNew.style.display="none";
				        <%} %>
					    var a = document.createElement("a");
					    var id = dt.Rows[i].Cate_ID;
    					if(id== 48 || id == 95){
					        a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','SecrList');";
					        imgNew.style.display = "none";
					    }else if(id== 49 || id == 95){
					        a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','SecrSec');";
					        imgNew.style.display = "none";
					    }else{
					         a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','ListPosition<%=strModelKeyID %>');";
					          
					    }
					    a.title = dt.Rows[i].Cate_Name;
					    a.innerHTML = dt.Rows[i].Cate_Name.sub(14);
					    
				    }
				    else    //如果还有下级节点
				    {
					    var li = document.createElement("li");
					    li.className = "Closed";
					    li.id = "li_" + dt.Rows[i].Cate_ID;
    					
					    var img = document.createElement("img");
					    img.id = dt.Rows[i].Cate_ID;
					    img.className = "s";
					    img.src = "../../css/s.gif";
					    img.onclick = function () {
						    ExpandSubCategory(this.id);
					    };
					    img.alt = "展开/折叠";
    					
					    var a = document.createElement("a");
					    a.href = "javascript:ExpandSubCategory(" + dt.Rows[i].Cate_ID + ",'editCate');";
					    a.innerHTML = dt.Rows[i].Cate_Name.sub(14);
					    
				    }
				    li.appendChild(img);
				    li.appendChild(a);
				    if(dt.Rows[i].Cate_IsChild == 1){
				        li.appendChild(imgNew);
				    }
				    ul.appendChild(li);	
			    }
			    
			    var li = document.createElement("li");
			    li.className = "Child";
			    li.id = "li_Js";
				
			    var img = document.createElement("img");
			    img.id = "Img_Js";
			    img.className = "s";
			    img.src = "../../css/s.gif";
				
			    var a = document.createElement("a");
			    var id = "a_Js";
			    a.href = "javascript:OpenOther('JobSeekerList.aspx');";
			    a.innerHTML ="简历管理";
			    li.appendChild(img);
				li.appendChild(a);
				ul.appendChild(li);	
				
				var li = document.createElement("li");
			    li.className = "Child";
			    li.id = "li_Cr";
				
			    var img = document.createElement("img");
			    img.id = "Img_Cr";
			    img.className = "s";
			    img.src = "../../css/s.gif";
				
			    var a = document.createElement("a");
			    var id = "a_Cr";
			    a.href = "javascript:OpenOther('CandList.aspx');";
			    a.innerHTML ="应聘记录";
			    li.appendChild(img);
				li.appendChild(a);
				ul.appendChild(li);	
				    
			    li_father.appendChild(ul);
			    //先显示稍等。。。
			    switchNote(iCategoryID, false);
		    }
    		
		    // 叶子节点的单击响应函数
		    function OpenDocument(iCategoryID,Action)
		    {
			    //window.EditMain.location.href = Action + ".aspx?PermissionID=<%=strPermissionID %>&TopCateID=<%= strTopCateID%>&CatID="+iCategoryID;
			    window.EditMain.location.href = "ListPosition<%=strModelKeyID %>.aspx?PermissionID=<%=strPermissionID %>&TopCateID=<%= strTopCateID%>&CatID="+iCategoryID;
		    }
            function OpenEditPage(iCategoryID,Action)
		    {
			    window.location.href = "EditPosition<%=strModelKeyID %>.aspx?PermissionID=<%=strPermissionID %>&TopCateID=<%= strTopCateID%>&CatID="+iCategoryID + "&action=" + Action;
			    
		    }
		    function ChangeStatus(iCategoryID)
		    {
			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (li_father.className == "Closed")
			    {
				    li_father.className = "Opened";
			    }
			    else
			    {
				    li_father.className = "Closed";
			    }				
		    }

		    function switchNote(iCategoryID, show)
		    {
			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (show)
			    {
				    var ul = document.createElement("ul");
				    ul.id = "ul_note_" + iCategoryID;
    				
				    var note = document.createElement("li");
				    note.className = "Child";
    				
				    var img = document.createElement("img");
				    img.className = "s";
				    img.src = "../../css/s.gif";
    				
				    var a = document.createElement("a");
				    a.href = "javascript:void(0);";
				    a.innerHTML = "请稍候...";
    				
				    note.appendChild(img);
				    note.appendChild(a);
				    ul.appendChild(note);
				    li_father.appendChild(ul);
			    }
			    else
			    {
				    var ul = document.getElementById("ul_note_" + iCategoryID);
				    if (ul)
				    {
					    li_father.removeChild(ul);
				    }				
			    }
		    }

		    function OpenOther(Url)
		    {
			    window.EditMain.location.href = Url;
		    }
            function InitTree()
            {
		        // 加载根节点
		        var tree = document.getElementById("CategoryTree");
		        var root = document.createElement("li");
		        root.id = "li_<%=TerrFatherID %>";
		        tree.appendChild(root);
        		var ID = <%=TerrFatherID %>;
		        // 加载页面时显示第一级分类
		        ExpandSubCategory(ID);
		    }
		    String.prototype.sub = function(n)
            {
              var r = /[^\x00-\xff]/g;
              if(this.replace(r, "mm").length <= n) return this;
              n = n - 3;
              var m = Math.floor(n/2);
              for(var i=m; i<this.length; i++)
              {
                if(this.substr(0, i).replace(r, "mm").length>=n)
                {
                  return this.substr(0, i) +"...";
                }
              }
              return this;
            };

    </script>
</head>
<body onload="InitTree()">
    <form id="form1" runat="server">
    <div id="incontent">
      <div class="clear"></div>
      <div class="contable">
        <div class="con-ico">
          <div class="con-fl">当前位置：招聘信息管理</div>
          <div class="con-fr">
            <img src="../../images/img-fontid.gif" title="本页技术支持编号" alt="" />010500
          </div>
        </div>
        <div class="clear"></div>
        <div class="hr"></div>
        <div class="imgadnfont">
          <div class="float">
            <img src="../../images/UserloginLog.gif" alt="" />
          </div>
          <div style="line-height: 20px;">
            在这里主要是管理网站上一些简单的，类似公司简介等的一些信息。这些信息般更新比较少，所有的栏目多和前台相应的栏目对应，如需更动栏目，需要设计师的帮助。
          </div>
        </div>
        <div class="clear"></div>
          <div id="leftCate" style="width:200px; float:left;">
            <div class="TreeMenu" id="CategoryTree">
              
		    </div>    
		    <input type="hidden" id="TextBox1" runat="server" name="节点ID" /><br />
            <input type="hidden" id="TextBox2" runat="server" name="父节点ID" /><br />
          </div>
          <div id="RightCate" style="width:530px; float:left">
           <iframe frameborder="0" style="width:530px; height:330px;" src="ListPosition<%=strModelKeyID %>.aspx" id="EditMain" name="EditMain"></iframe>
          </div>
        </div>

    </div>
    <script language="javascript" type="text/javascript">
        var strCateID = <%= (Request.QueryString["CatID"] + "") %>;
        if(strCateID != "")
        {
            OpenDocument(strCateID, "edit");
        }
    </script>
    </form>
</body>
</html>
